package edu.stanford.bmir.protege.web.client.ui.ontology.stkos.mapper.common;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.menu.BaseItem;
import com.gwtext.client.widgets.tree.TreeNode;

import edu.stanford.bmir.protege.web.client.project.Project;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.StkosUtilServiceManager;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.common.UtilConstants;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.common.UtilEntityType;
import edu.stanford.bmir.protege.web.client.ui.library.msgbox.MessageBox;
import edu.stanford.bmir.protege.web.client.ui.ontology.stkos.common.GWTExtUtil;
import edu.stanford.bmir.protege.web.client.ui.ontology.stkos.common.treepanel.AbstractStkosTreePanel;

public class StkosMapperDeleteMapperNumberMenuItem extends
		AbstractStkosMapperMenuItem {

	public static final String TEXT = "删除映射号";
	public static final String ICONCLS = "stkos_delete";
	public static final boolean DISABLED = false;

	public StkosMapperDeleteMapperNumberMenuItem(
			AbstractStkosTreePanel treePanel, Project project,
			Project accordingProject, TreeNode treeNode) {
		super(treePanel, project, accordingProject, treeNode, TEXT, ICONCLS,
				DISABLED);
		initDisabled();
	}

	protected void initDisabled() {
		boolean disabled = false;
		mapperNumber = getMapperNumber();
		if (mapperNumber == null || mapperNumber < 0) {
			disabled = true;
		}
		setDisabled(disabled);
	}

	@Override
	public void onClick(BaseItem item, EventObject event) {
		deleteMapperNumber();
	}
}
